Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the roundoff domain in enforcePeriodic. #2679

Merged

Conversation

atmyers
Copy link
Member

@atmyers atmyers commented Mar 25, 2022

This fixes some roundoff issues seen with single precision runs on Fugaku.

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@atmyers atmyers requested a review from jmsexton03 March 25, 2022 17:25
@atmyers
Copy link
Member Author

atmyers commented Mar 25, 2022

From @WeiqunZhang in slack:

I am still worried about it when Real and ParticelReal are different.
What I am worried about are two things.  (1) The bisection is doing (Real - Real)*Real, whereas the particle codes do (ParticleReal-Real)*Real.  (2) Roundoff domain the hi is stored in Real.  It's cast ParticleReal when we use it in enforcePeriodic.  It's not clear to me that's 100% robust.
So I think instead of RealBox roundoff_domain, we should have GpuArray<double,AMREX_SPACEDIM> roundoff_hi_d and GpuArray<float,AMREX_SPACEDIM> roundoff_hi_f.
The bisection should mimic exactly (double_or_float - Real) * Real.
In particle codes, we can have a function that always return the roundoff hi in ParticleReal.   That function can contains ifdef to decide which one to use, roundoff_hi_f or roundoff_hi_d.
Anymore I think the PR is good enough for WarpX right now.  So feel free to merge it as is.
But in long term, it might bite us again.

Since this is time-critical for @lucafedeli88 I will merge as is, but I will address the mixed precision issue soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants